<template>
	<view class="page-fade-in" :style="{opacity: pageOpc}">
		<template v-if="pageOpc">
			<view class="content">
				<view class="input-box">
					<view class="input-item flexWrapNo">
						<image src="../static/home/nickname-icon.png" class="input-img"></image>
						<input placeholder="请输入联系人姓名" placeholder-class="placeholderClass" v-model="username"/>
					</view>
					<view class="input-item flexWrapNo">
						<image src="../static/home/phone-icon.png" class="input-img"></image>
						<input placeholder="请输入手机号" type="number" maxlength="11" placeholder-class="placeholderClass" v-model="mobile"/>
					</view>
					<view class="join-btn" @tap="join()">提交</view>
				</view>
				<!-- <view class="franchise-btn">我要加盟</view> -->
			</view>
		</template>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageOpc:0,
				username:"",
				mobile:""
			}
		},
		onLoad() {
			
		},
		onReady(){
			setTimeout(() => {
				this.pageOpc=1
			}, 100)
		},
		methods: {
			join(){
				if(!this.username){
					this.$tools.showToast('请填写联系人姓名')
					return;
				}else if(!this.mobile){
					this.$tools.showToast('请填写手机号')
					return;
				}else if(this.mobile.length!=11){
					this.$tools.showToast('请填写正确的手机号')
					return;
				}
				this.$request.post(this.$api.join, {
					store_id:uni.getStorageSync('store_id'),
					username:this.username,
					mobile:this.mobile
				}, {
					token:true
				}).then(res => {
					let {
						data = {}
					} = res;
					if (res.code==1) {
						this.$tools.showToast('您的信息已提交，商务人员会尽快联系您')
						setTimeout(() => {
							uni.navigateBack()
						}, 1000)
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.content{
		background: url(../static/home/joinBg.png) no-repeat center/100% 100%;
		height: 94.6vh;
	}
	.franchise-btn{
		height: 144rpx;
		line-height: 144rpx;
		text-align: center;
		background: linear-gradient( 97deg, #4AA22A 0%, #69D037 100%);
		border-radius: 72rpx;
		font-size: 36rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		margin: auto;
		position: fixed;
		left: 24upx;
		right: 24upx;
		bottom: 64upx;
	}
	.input-box{
		padding: 48upx 28upx;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		margin: auto;
		background:RGBA(53, 59, 56, .8);
		border-top-left-radius:72upx;
		border-top-right-radius:72upx;
		.input-item{
			margin-bottom: 20upx;
			height: 144rpx;
			border-radius: 72upx;
			padding: 0 24upx;
			background: #232428;
			text,input{
				font-size: 30rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #FFFFFF;
			}
			.input-img{
				width: 96upx;
				height: 96upx;
				margin-right: 17upx;
			}
			input{
				flex: auto;
			}
			.placeholderClass{
				font-size: 34rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color:#BDBDBF;
			}
		}
		.join-btn{
			height: 144rpx;
			line-height: 144rpx;
			text-align: center;
			background: linear-gradient( 97deg, #4AA22A 0%, #69D037 100%);
			border-radius: 72rpx;
			font-size: 36rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			margin: auto;
		}
	}
</style>
